package com.wyl.auth.controller;

import com.wyl.auth.service.LoginService;
import com.wyl.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author WuYiLong
 * @Date 2024/11/30 15:13
 */
@Api(tags = "登录")
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @ApiOperation(value = "帐号密码登录")
    @PostMapping(value = "login")
    public ResponseData login(String username, String password,String code,boolean rememberMe) {
        loginService.doLogin(username,password,code,rememberMe);
        return ResponseData.getSuccess();
    }

    @ApiOperation(value = "退出")
    @GetMapping(value = "logout")
    public ResponseData logout() {
        loginService.logout();
        return ResponseData.getSuccess();
    }
}